<template>
  <div class="main">
    <div v-if="dataList.length <= 0">
      <el-empty description="空空如也"></el-empty>
    </div>
    <div class="main_box" v-else>
      <div class="main_row swiper" id="banner2">
        <div class="swiper-wrapper">
          <div class="swiper-slide" v-for="(item, index) in dataList" :key="index">
            <div class="item" v-for="(it, i) in item" :key="i" @click="linkTo(it.id)">
              <img :src="it.companyLogo" class="logo" />
              <div class="jobName">{{ it.jobName }}</div>
              <div class="salary">
                {{ it.lowestSalary }}-{{ it.highestSalary }}元/天
              </div>
              <div class="city">{{ it.city }}</div>
              <div class="item_bot">
                <span class="text">{{ it.workPeriod }}</span>
                <span class="lines"></span>
                <span class="text">{{ it.practicePeriod || 0 }}个月</span>
                <span class="lines" v-if="it.identify"></span>
                <span v-if="it.identify" class="text">{{
                  ["在校", "应届"][it.identify]
                }}</span>
                <span class="lines" v-if="it.education"></span>
                <span v-if="it.education" class="text">{{ it.education }}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="job_main_row">
        <div class="job-swiper-wrapper">
          <div class="job-swiper-slide" v-for="(item, index) in dataList" :key="index">
            <div class="item" v-for="(it, i) in item" :key="i" @click="linkTo(it.id)">
              <img :src="it.companyLogo" class="logo" />
              <div class="jobName">{{ it.jobName }}</div>
              <div class="salary">
                {{ it.lowestSalary }}-{{ it.highestSalary }}元/天
              </div>
              <div class="city">{{ it.city }}</div>
              <div class="item_bot">
                <span class="text">{{ it.workPeriod }}</span>
                <span class="lines"></span>
                <span class="text">{{ it.practicePeriod || 0 }}个月</span>
                <span class="lines" v-if="it.identify"></span>
                <span v-if="it.identify" class="text">{{
                  ["在校", "应届"][it.identify]
                }}</span>
                <span class="lines" v-if="it.education"></span>
                <span v-if="it.education" class="text">{{ it.education }}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- <div class="job_wrapper" v-for="(item, index) in dataList"
                :key="index">
        <div class="job_item" v-for="(it, i) in item"
                :key="i" @click="linkTo(it.id)">
          <div class="job_content">
            <div class="job_title">
              <div class="job_name">{{ it.jobName }}</div>
              <div class="job_money">{{ it.highestSalary }}元/天</div>
            </div>
            <div class="job_info">
              <div>{{ it.workPeriod }}</div>
              <span class="line"></span>
              <div>{{ it.practicePeriod || 0 }}个月</div>
              <span class="line" v-if="it.identify"></span>
                <span class="line" v-if="it.identify"></span>
              <div v-if="it.identify">{{
                ["在校", "应届"][it.identify]
              }}</div>
              <span class="lines" v-if="it.education"></span>
              <div v-if="it.education" class="text">{{ it.education }}</div>
            </div>
          </div>
            <div class="job_complany_box">
              <div class="job_complany_info">
                <img class="job_complany_image" :src="it.companyLogo"/>
                <div class="job_complany">{{it.companyName }}</div>
              </div>
              <div class="job_city">{{it.city }}</div>
            </div>
        </div>
      </div> -->
    </div>
  </div>
</template>

<script>
import Swiper from "swiper";
import "swiper/css/swiper.min.css";

export default {
  name: "item1",
  props: {
    dataList: Array,
  },
  components: {},
  data() {
    return {
      swiper: null,
    };
  },
  watch: {},
  methods: {
    linkTo(id) {
      localStorage.setItem("currentJobId", id);
      this.$router.push({ path: `/jobDetail/${id}` });
    },
    slidePrev() {
      this.swiper.slidePrev();
    },
    slideNext() {
      this.swiper.slideNext();
    },
    initSwiper() {
      if (this.swiper === null) {
        this.swiper = new Swiper("#banner2", {
          observer: true,
          observeParents: true,
        });
      }
    },
  },
  created() {
    console.log(this.dataList)
  },
  mounted() { },
};
</script>
<style lang="less" scoped>
.main {
  width: 100%;
  overflow: hidden;
}

.job_main_row {
  display: none;
}

.main_box {
  width: 100%;
  position: relative;
  height: 495px;
  overflow-x: hidden;

  .main_row {
    display: inline-block;
    width: 100%;
    padding: 30px 0 0;
    height: 492px;
    overflow: hidden;

    .swiper-slide {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      padding: 0 30px;
      height: 462px;
    }

    .item {
      width: calc((100% - 50px) / 3);
      height: 206px;
      background: #ffffff;
      border: 1px solid #ebebeb;
      box-shadow: 0px 0px 33px 2px rgba(124, 124, 124, 0.17);
      border-radius: 10px;
      margin-bottom: 25px;
      margin-right: 25px;
      transition-duration: 0.3s;
      padding: 30px;
      padding-bottom: 54px;
      padding-right: 105px;
      position: relative;
      font-family: MicrosoftYaHei;
      line-height: 20px;
      font-weight: 400;
      overflow: hidden;
      cursor: pointer;

      .logo {
        position: absolute;
        width: 68px;
        height: 68px;
        border-radius: 50%;
        right: 34px;
        top: 30px;
      }

      &>div {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }

      .jobName {
        font-size: 19px;
        color: #000;
        margin-bottom: 20px;
      }

      &:hover .jobName {
        color: #15389a;
      }

      .salary {
        font-size: 18px;
        color: #fa606a;
        margin-bottom: 17px;
      }

      .city {
        font-size: 18px;
        color: #000000;
      }

      .item_bot {
        width: 100%;
        position: absolute;
        left: 0;
        bottom: 0;
        height: 54px;
        padding: 0 35px;
        display: flex;
        align-items: center;
        border-top: 1px solid #ebebeb;
        font-size: 16px;
        font-family: MicrosoftYaHeiLight;
        font-weight: 400;
        color: #999999;
        line-height: 17px;
        background: linear-gradient(90deg,
            rgb(233, 244, 255) 0%,
            rgb(250, 250, 250) 100%);

        .lines {
          width: 1px;
          height: 17px;
          opacity: 0.7;
          background: #9ca8be;
          margin: 0 13px;
        }
      }

      &:nth-child(3),
      &:nth-child(6) {
        margin-right: 0;
      }

      &:hover {
        box-shadow: 0px 0px 28px 2px rgba(124, 124, 124, 0.41);
        // transform: scale(1.02);
      }
    }
  }
}

@media screen and (max-width: 480px) {
  .main_box {
    width: 100%;
    position: relative;
    height: auto;
    overflow-x: hidden;

    .main_row {
      display: none;
    }

    .job_main_row {
      display: block;
      width: 100%;
      padding: 30px 0 0;
      // height: 492px;
      overflow: hidden;

      .job-swiper-slide {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        padding: 0 10px;
        // height: 462px;
      }

      .item {
        width: 100%;
        height: 133px;
        background: #ffffff;
        border: 1px solid #ebebeb;
        // box-shadow: 0px 0px 33px 2px rgba(124, 124, 124, 0.17);
        box-shadow: none;
        border-radius: 10px;
        margin-bottom: 10px;
        // margin-right: 25px;
        transition-duration: 0.3s;
        // padding: 30px;
        padding: 17px 15px 0;
        // padding-bottom: 54px;
        // padding-right: 105px;
        // padding-top: 17px;

        position: relative;
        font-family: MicrosoftYaHei;
        line-height: 20px;
        font-weight: 400;
        overflow: hidden;
        cursor: pointer;

        .logo {
          position: absolute;
          width: 50px;
          height: 50px;
          border-radius: 50%;
          right: 15px;
          border: 1px solid #EEEEEE;
          top: 25px;
        }

        &>div {
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }

        .jobName {
          font-size: 14px;
          color: #000;
          margin-bottom: 5px;
        }

        &:hover .jobName {
          color: #15389a;
        }

        .salary {
          font-size: 12px;
          color: #fa606a;
          line-height: 17px;
          margin-bottom: 4px;
        }

        .city {
          font-size: 12px;
          color: #000000;
          margin-bottom: 15px;
        }

        .item_bot {
          width: 100%;
          position: absolute;
          left: 0;
          bottom: 0;
          height: 41px;
          padding-left: 15px;
          display: flex;
          align-items: center;
          border-top: 1px solid #ebebeb;
          font-size: 12px;
          font-family: MicrosoftYaHeiLight;
          font-weight: 400;
          color: #999999;
          line-height: 17px;
          background: linear-gradient(90deg,
              rgb(233, 244, 255) 0%,
              rgb(250, 250, 250) 100%);

          .lines {
            width: 1px;
            height: 17px;
            opacity: 0.7;
            background: #9ca8be;
            margin: 0 13px;
          }
        }

        &:nth-child(3),
        &:nth-child(6) {
          margin-right: 0;
        }

        &:hover {
          // box-shadow: 0px 0px 28px 2px rgba(124, 124, 124, 0.41);
          box-shadow: none;
          // transform: scale(1.02);
        }
      }
    }
  }

  // .main_box{
  //   .main_row{
  //     display: none;
  //   }
  //   height: auto;
  //   padding: 15px 10px 0;
  //   .job_wrapper{
  //     display: block;
  //     // padding: 15px 10px;
  //     .job_item{
  //       padding: 15px;
  //       background: #FFFFFF;
  //       border-radius: 7px;
  //       border: 1px solid #D4D6DA;
  //       margin-bottom: 10px;
  //       .job_content{
  //         border-bottom: 1px solid #EBEBEB;
  //         .job_title{
  //           display: flex;
  //           justify-content: space-between;
  //           margin-bottom: 15px;
  //           .job_name{
  //             font-size: 16px;
  //             font-family: PingFangSC-Medium, PingFang SC;
  //             font-weight: 500;
  //             color: #37383D;
  //             line-height: 22px;
  //           }
  //           .job_money{
  //             font-size: 13px;
  //             font-family: PingFangSC-Regular, PingFang SC;
  //             font-weight: 400;
  //             color: #FA606A;
  //             line-height: 18px;
  //           }
  //         }
  //         .job_info{
  //           display: flex;
  //           align-items: center;
  //           margin-bottom: 14px;
  //           color: #9597A0;
  //           .line{
  //             margin: 0 12px;
  //             width: 1px;
  //             height: 10px;
  //             opacity: 0.7;
  //             border: 1px solid #9CA8BE;
  //           }
  //         }

  //       }
  //       .job_complany_box{
  //         display: flex;
  //         justify-content: space-between;
  //         align-items: center;
  //         padding-top: 12px;
  //         .job_complany_info{
  //           display: flex;
  //           justify-content: center;
  //           align-items: center;
  //           .job_complany_image{
  //             width: 30px;
  //             height: 30px;
  //             border-radius: 50%;
  //           }
  //           .job_complany{
  //             margin-left: 8px;
  //             font-size: 14px;
  //             font-family: PingFangSC-Regular, PingFang SC;
  //             font-weight: 400;
  //             color: #37383D;
  //             line-height: 20px;
  //           }

  //         }
  //         .job_city{
  //             font-size: 14px;
  //             font-family: PingFangSC-Regular, PingFang SC;
  //             font-weight: 400;
  //             color: #9597A0;
  //             line-height: 20px;
  //           }
  //       }
  //     }
  //   }
  // }
}
</style>
